package models

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	Title   string  `gorm:"type:varchar(150);not null;commit:'订单名称'"`
	OrderSn string  `gorm:"type:char(36);not null;commit:'订单编号'"`
	Amount  float64 `gorm:"type:decimal(10,2);not null;commit:'订单价格'"`
	Stock   int64   `gorm:"type:int;not null;commit:'订单数量'"`
	Status  int64   `gorm:"type:int;not null;commit:'订单状态:0-已支付,1-未支付,2-待支付'"`
}
type OrderGood struct {
	gorm.Model
	GoodsTitle string  `gorm:"type:varchar(150);not null;commit:'订单名称'"`
	GoodsPrice float64 `gorm:"type:decimal(10,2);not null;commit:'订单价格'"`
	Image      string  `gorm:"type:varchar(150);not null;commit:'订单图片'"`
	GoodsNum   int     `gorm:"type:varchar(150);not null;commit:'订单数量'"`
}

func (o *Order) OrderAdd() error {
	return DB.Create(&o).Error
}
func (og *OrderGood) OrderGoodAdd() error {
	return DB.Create(&og).Error
}
